xen/gnttab: Rework resource acquisition
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 27 Jul 2020 12:40:06 +0000 (13:40 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 30 Jan 2021 03:21:33 +0000 (03:21 +0000)
commit52531c734ea1e696e60faf358ef735acb2b325da
treef946cecb512b616c00dff246e1a8a897a3bc23f5
parent25164f35789c38cf53e08259350f23608aaef367
xen/gnttab: Rework resource acquisition

The existing logic doesn't function in the general case for mapping a guests
grant table, due to arbitrary 32 frame limit, and the default grant table
limit being 64.

In order to start addressing this, rework the existing grant table logic by
implementing a single gnttab_acquire_resource().  This is far more efficient
than the previous acquire_grant_table() in memory.c because it doesn't take
the grant table write lock, and attempt to grow the table, for every single
frame.

The new gnttab_acquire_resource() function subsumes the previous two
gnttab_get_{shared,status}_frame() helpers.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen/common/grant_table.c
xen/common/memory.c
xen/include/xen/grant_table.h